#include <stdio.h>
#include <string.h>

int main()
{
    int T = 0;
    scanf("%d", &T);
    char arr1[10001] = {0};
    char arr2[10001] = {0};
    char ret[101][10001] = {0};
    for(int k = 0; k < T; k++)
    {
        char* tmp = &ret[k][0];
        scanf("%s", arr1);
        scanf("%s", arr2);
        int len = strlen(arr1);
        int hm1 = len, hm2 = len;//记录汉明数
        tmp[len] = '\0';
        for(int i = 0; i < len; i++)
        {
            tmp[i] = 'a';
            if(arr1[i] == 'a')
            hm1--;
            if(arr2[i] == 'a')
            hm2--;
        }
        int op = len - 1;
        while(hm1 != hm2)
        {
            if(arr1[op] == arr2[op])//两个相同，改变无意义且会增大字符
            {
                op--;
            }
            else if(hm1 - hm2 >= 2&&'a' == arr2[op])//汉明数相差超过二
            {
                tmp[op] = arr1[op];
                hm1--;
                hm2++;
                op--;
            }
            else if(hm2 - hm1 >= 2&&'a' == arr1[op])
            {
                tmp[op] = arr2[op];
                hm2--;
                hm1++;
                op--;
            }
            else if(op >= 1&&hm1 - hm2 == 2&&'a' == arr2[op - 1]&&arr1[op - 1] == 'b')//下一次能改两，且刚好差两
            {
                tmp[op - 1] = arr1[op - 1];
                hm1--;
                hm2++;
                op--;
            }
            else if(op >= 1&&hm2 - hm1 == 2&&'a' == arr1[op - 1]&&arr2[op - 1] == 'b')
            {
                tmp[op - 1] = arr2[op - 1];
                hm2--;
                hm1++;
                op--;
            }
            else if(hm1 > hm2&&'a' != arr1[op]&&'a' != arr2[op])
            {
                tmp[op] = arr1[op];
                hm1--;
                op--;
            }
            else if(hm1 < hm2&&'a' != arr1[op]&&'a' != arr2[op])
            {
                tmp[op] = arr2[op];
                hm2--;
                op--;
            }
            else if(hm1 - hm2 == 1&&'a' == arr2[op])
            {
                for(char j = 'a'; j <= 'z'; j++)
                {
                    if(arr1[op] != j&&arr2[op] != j)
                    {
                        tmp[op] = j;
                        break;
                    }
                }
                hm2++;
                op--;
            }
            else if(hm2 - hm1 == 1&&'a' == arr1[op])
            {
                for(char j = 'a'; j <= 'z'; j++)
                {
                    if(arr1[op] != j&&arr2[op] != j)
                    {
                        tmp[op] = j;
                        break;
                    }
                }
                hm1++;
                op--;
            }
            else
            {
                op--;
            }
        }
    }
    for(int i = 0; i < T; i++)
    {
        printf("Case %d: %s\n", i + 1, ret[i]);
    }
    return 0;
}